import { RouteView, PageView } from '@/components/layouts'

/**
 * 主路由 && 主菜单项配置
 *
 * note：因项目角色单一化，所以菜单全部由前端模块配置
 * 若需要改为后端返回模版，改为动态获取permission list菜单即可
 */
const mainRoutes = [
  ///商户首页模块
  {
    path: '/dashboard/analysis',
    name: 'Analysis',
    component: () => import('@/views/dashboard/Analysis'),
    meta: { title: '首页', icon: 'home' }
  },

  ///交易管理模块
  {
    path: '/trade',
    name: 'Trade',
    component: PageView,
    redirect: '/trade/orderQuery',
    meta: {
      keepAlive: false,
      internalOrExternal: false,
      icon: 'inbox',
      title: '交易管理'
    },
    children: [
      {
        path: '/trade/orderQuery',
        name: 'OrderQuery',
        component: () => import('@/views/modules/trade/OrderQuery.vue'),
        meta: {
          keepAlive: false,
          internalOrExternal: false,
          title: '订单查询'
        }
      },
      {
        path: '/trade/rateQuery',
        name: 'rateQuery',
        component: () => import('@/views/modules/trade/RateQuery.vue'),
        meta: {
          keepAlive: false,
          internalOrExternal: false,
          title: '资费查询'
        }
      }
    ]
  },

  ///收支明细模块
  {
    path: '/income',
    name: 'Income',
    component: PageView,
    redirect: '/income/incomeList',
    meta: {
      keepAlive: false,
      internalOrExternal: false,
      icon: 'pay-circle',
      title: '财务管理'
    },
    children: [
      {
        path: '/income/incomeList',
        name: 'IncomeList',
        component: () => import('@/views/modules/income/IncomeList.vue'),
        meta: {
          keepAlive: false,
          internalOrExternal: false,
          title: '收支明细'
        }
      },
      {
        path: '/income/withdrawApply',
        name: 'WithdrawApply',
        component: () => import('@/views/modules/income/WithdrawApply.vue'),
        meta: {
          keepAlive: false,
          internalOrExternal: false,
          title: '提现申请'
        }
      },
      {
        path: '/income/checkRecords',
        name: 'CheckRecords',
        component: () => import('@/views/modules/income/CheckRecords.vue'),
        meta: {
          keepAlive: false,
          internalOrExternal: false,
          title: '结算记录'
        }
      },
      {
        path: '/income/cashAccount',
        name: 'CashAccount',
        component: () => import('@/views/modules/income/CashAccount.vue'),
        meta: {
          keepAlive: false,
          internalOrExternal: false,
          title: '收款账户'
        }
      }
    ]
  },

  ///账户管理模块
  {
    path: '/account',
    name: 'Account',
    component: PageView,
    redirect: '/account/realnameCheck',
    meta: { title: '账户管理', icon: 'user' },
    children: [
      {
        path: '/account/realnameCheck',
        name: 'RealnameCheck',
        component: () => import('@/views/modules/account/RealnameCheck.vue'),
        meta: {
          keepAlive: false,
          internalOrExternal: false,
          title: '实名认证'
        }
      },
      {
        path: '/account/passwordReset',
        name: 'PasswordReset',
        component: () => import('@/views/modules/account/PasswordReset.vue'),
        meta: {
          keepAlive: false,
          internalOrExternal: false,
          title: '修改密码'
        }
      },
      {
        path: '/account/cashPwdReset',
        name: 'CashPwdReset',
        component: () => import('@/views/modules/account/CashPwdReset.vue'),
        meta: {
          keepAlive: false,
          internalOrExternal: false,
          title: '提现密码'
        }
      },
      {
        path: '/account/settings',
        name: 'Settings',
        meta: {
          keepAlive: false,
          internalOrExternal: false,
          title: '个人设置',
          hideHeader: true
        },
        redirect: '/account/settings/base',
        alwaysShow: true,
        component: () => import('@/views/modules/account/settings/Index.vue'),
        children: [
          {
            path: '/account/settings/base',
            name: 'BaseSettings',
            component: () => import('@/views/modules/account/settings/BaseSettings.vue'),
            meta: { title: '基本设置', hidden: true, keepAlive: true }
          },
          {
            path: '/account/settings/res',
            name: 'ResSettings',
            component: () => import('@/views/modules/account/settings/ResSettings.vue'),
            meta: { title: '商户资料', hidden: true, keepAlive: true }
          }
        ]
      }
    ]
  },

  ///站内消息
  {
    path: '/notification',
    name: 'Notification',
    component: RouteView,
    meta: {
      keepAlive: false,
      internalOrExternal: false,
      icon: 'inbox',
      title: '站内信息'
    },
    children: [
      {
        path: '/notification/message',
        name: 'Message',
        component: () => import('@/views/modules/notification/Message.vue'),
        meta: { title: '消息通知', icon: 'bell' }
      }
    ]
  }
]

export default mainRoutes
